package com.wgz.mp.generator.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;

/**
 * @author wgz
 * @title
 * @Package PACKAGE_NAME
 * @data 2021/4/1 19:26
 */
public class MyMetaObjectHandler implements MetaObjectHandler {
    public void insertFill(MetaObject metaObject) {
        //在插入的时候执行
        this.strictInsertFill(metaObject,"createTime", Date.class , new Date());
        this.strictInsertFill(metaObject,"updateTime", Date.class , new Date());
    }

    public void updateFill(MetaObject metaObject) {
        //在更新的时候执行
        this.strictInsertFill(metaObject,"upateTime", Date.class , new Date());
    }
}
